<?php if (!defined('THINK_PATH')) exit();?><div style="float:left">
	<ul class="nav nav-list bs-docs-sidenav" style="margin:0;width:100px">
		<?php if(is_array($group)): $i = 0; $__LIST__ = $group;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li><a href="javascript:void(0)" id="group_<?php echo ($vo["group_id"]); ?>"><i class="icon-chevron-right"></i><?php echo ($vo["group_name"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
	</ul>
</div>
<div style="width:400px;float:right;">
	<table class="table table-condensed table-bordered table-hover holiday-content" style="height:100%">
		<thead><tr><td>联系人</td><td>操作</td></tr></thead>
		<tbody>
			<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vi): $mod = ($i % 2 );++$i;?><tr><td><a style="height:20px;text-align:left;"><?php echo ($vi["name"]); echo ($vi["mobile"]); ?></a></td><td width=50><i class="icon-plus" style="cursor:pointer;opacity:0.6" id="iclass_<?php echo ($vi["contacter_id"]); ?>" onclick="addToSendList(<?php echo ($vi["contacter_id"]); ?>,<?php echo ($vi["mobile"]); ?>)"></i><i class="icon-trash" id="itrash_<?php echo ($vi["contacter_id"]); ?>" style="margin-left:8px;cursor:pointer;display:none" onclick="cancelToSendList(<?php echo ($vi["contacter_id"]); ?>,<?php echo ($vi["mobile"]); ?>)"></i></td></tr><?php endforeach; endif; else: echo "" ;endif; ?>
		</tbody>
	</table>
</div>
<div class="pagination" style="float:right">
	<?php echo ($page); ?>
</div>

<script>
	function reloadContact(){
	
	}
	function addToSendList($cid,$mobile){
		
		$("#iclass_"+$cid).attr('class',"icon-ok");
		$("#iclass_"+$cid).removeAttr('style');
		$("#itrash_"+$cid).show(233);
		var number = $mobile;
		var allMobile = $(".sendnumber").val();
		var pat = /^(13[0-9]{9})|(15[0-9]{9})|(18[0-9]{9})$/ ;
		if(number == ""){
			$.remind('警告','输入号码为空，请重新输入……');
			return;
		}
		
		if(!pat.test(number)){
			$.remind('警告','输入有不合法的号码:'+number);
			
			return;
		}
		if(allMobile != ''){
			var allMobileArray = allMobile.split(',');
			if($.inArray(number,allMobileArray)){
				$.remind('警告','已加入该号码');
				return;
			}
		}
		$("#sendnumber").val($("#sendnumber").val()+number+",");
		$(".sendnumber").val($(".sendnumber").val()+number+",");
	}
	function cancelToSendList($cid,$mobile){
		
		$("#iclass_"+$cid).attr('class',"icon-plus");
		$("#iclass_"+$cid).css({cursor:'pointer',opacity:'0.6'});
		$("#itrash_"+$cid).hide(233);
		var allMobile = $(".sendnumber").val();
		if(allMobile != ''){
			var allMobileArray = allMobile.split(',');
			var i = $.inArray($mobile,allMobileArray)
 			if(i){
				allMobileArray =allMobileArray.slice(i);
				var mobileString;
				for(var k = 0; k < allMobileArray.lenth;k++){
					mobileString +=  allMobileArray[i]+",";
				}
				
				$("#sendnumber").val(mobileString);
				$(".sendnumber").val(mobileString);
			}else{
				$.remind('警告','不存在该号码');
				return;
			}
		}

	}
	
</script>